package main

import "fmt"

type calc func(int, int) int

func add(a int, b int) int {
	return a + b
}

func sub(a, b int) int {
	return a - b
}

func do(o string) (calc, error) {
	switch o {
	case "add":
		return add, nil
	case "sub":
		return sub, nil
	default:
		return func(a int, b int) int {
			return a * b
		}, nil
	}
}

func main() {
	c, _ := do("11")
	i := c(1, 2)
	fmt.Println(i)
}
